/**
 * Hoc 封装
 */
import React, { FC } from 'react';
import { history, Link } from 'umi';
import useAuthHook from '@/hooks/useAuth';

interface AuthProps {}
const Auth: FC<AuthProps> = props => {
  const [isLogin, time] = useAuthHook();

  if (!isLogin) {
    history.push('/demo3/test2/abc');
  }

  return (
    <div>
      <h4>Auth: {time}</h4>
      <Link to="/login">Login</Link>
      {props.children}
    </div>
  );
};

export default Auth;
